import 'package:get/get.dart';
import 'package:todo_project/api/home_img/bing_img_entity.dart';
import 'package:todo_project/api/home_img/home_img_api.dart';
import 'package:todo_project/single_instance/dio_instance.dart';

class HomeControl extends GetxController {
  var picUrlStream = "".obs;

  Future getImgUrl() async {
    BingImgEntity data = await ImageRequest(DioInstance().dio).getHeaderImg();
    printInfo(info: data.toString());
    String url = data.images?.first.urlbase ?? "";
    if(url.isNotEmpty){
      picUrlStream.value = "http://s.cn.bing.net/${url}_1920x1080.jpg";
    }

    return;
  }
}
